<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">
	$(function() {
		var $grid = $('#grid_file_bidding');
		var $title = '标书';
		var $baseUrl = 'file/bidding';
		$grid.datagrid(
				{
					title : $title + '列表',
					url : $baseUrl + '/page?sort=createTime,desc',
					dialog : {
						url : $baseUrl,
						name : $title,
						audit : {
							name : '审核标书',
							title : '标书审核',
							width : 400,
							height : 400,
							url : 'audit'
						}
					},
					onSelect : function(index, row) {
						var $grid = $(this);
						if (row.audit == undefined) {
							$grid.datagrid('toolbar.text.enable', [ '审核' ]);
						} else {
							$grid.datagrid('toolbar.text.disable', [ '审核' ]);
						}
					},
					pagination : true,
					pageSize : 50,
					pageList : [ 50, 100, 200 ],
					columns : [ [
							{
								field : 'locked',
								title : '状态',
								width : 40,
								fixed : true,
								align : 'center',
								formatter : function(value, row, index) {
									if (row.audit == undefined) {
										return '';
									}
									return row.audit ? '<span class="icon-ok" style="display: inline-block;width: 18px; height: 20px;"> </span>'
											: '<span class="icon-cross" style="display: inline-block;width: 18px; height: 20px;"> </span>';
								}
							}, {
								field : 'name',
								width : 120,
								title : '文件名称'
							}, {
								field : 'download',
								width : 40,
								title : '',
								formatter : function(value, row, index) {
									return '<a class="file_link" href="file/bidding/download?id=' + row.id + '">下载</a>';
								}
							}, {
								field : 'project',
								width : 120,
								title : '所属项目',
								formatter : function(value, row, index) {
									return row.project ? row.project.name : '';
								}
							}, {
								field : 'user',
								width : 80,
								title : '上传者',
								formatter : function(value, row, index) {
									return row.createUser ? row.createUser.name : '';
								}
							}, {
								field : 'auditUser',
								width : 80,
								title : '审核者',
								formatter : function(value, row, index) {
									return row.auditUser ? row.auditUser.name : '';
								}
							}, {
								field : 'description',
								width : 280,
								title : '审核说明'
							}, {
								field : 'createTime',
								width : 180,
								title : '上传时间'
							}, {
								field : 'auditTime',
								width : 180,
								title : '审核时间'
							} ] ],
					toolbar : [ {
						text : '审核',
						disabled : true,
						iconCls : 'icon-edit',
						handler : function() {
							$.crudgrid.getGrid(this).datagrid('dialog.update', 'audit');
						}
					}, '-', $.crudgrid.buttons.refresh ]
				}).treegrid('search.init');
	});
</script>
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',split:true,border:false">
		<table id="grid_file_bidding"></table>
	</div>
</div>